<template>
  <el-form ref="basicInfoForm" :model="info" :rules="rules" label-width="150px">
    <el-row>
      <el-col :span="12">
        <el-form-item label="商品名称" prop="goodsName">
          <el-input placeholder="请输入商品名称" v-model="info.goodsName" />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item prop="isVirtual">
          <span slot="label">虚拟产品</span>
          <el-select v-model="info.isVirtual" @change="tplSelectChange">
            <el-option label="否" value="0" />
            <el-option label="是" value="1" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="24">
        <el-form-item label="产品详情" prop="detail">
          <el-input type="textarea" :rows="3" v-model="info.detail"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
export default {
  props: {
    info: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
      rules: {
        goodsName: [
          { required: true, message: "请输入商品名称", trigger: "blur" }
        ],
        isVirtual: [
          { required: true, message: "请输入是否虚拟商品", trigger: "blur" }
        ],
        detail: [
          { required: true, message: "请输入详情", trigger: "blur" }
        ]
      }
    };
  }
};
</script>
